<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>限时抢购</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<include file="public/comm"/>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav fs_xl">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">限时抢购</h1>
		</header>
		<include file="public/bottom_nav"/>
		<div class="mui-content fs_xl">
			<p class="qg_dh fs_xl">抢购中 先购先得哦！</p>
			<div class="qg_time cls">
				<ul class="cls">
					<volist name="seckill_list"  id="vo">
						<li>
							<a href="{:U('Mobile/Goods/goodsInfo',array('id'=>$vo.goods_id))}">
								<p><img src="{$vo.original_img}" /></p>
								<p class="qg_tit fs_m">{$vo.goods_name}</p>
								<div class="qg_jdt">
									<span class="qg_span1 fs_xs" >已售<em> <if condition="$vo.saled gt 100" >100<else />{$vo.saled}</if>%</em></span>
									<span class="qg_span2 fs_m"><em></em></span>
								</div>
								<div class="qg_pri">
									<span class="fs_xs">¥<em class="fs_xi">{$vo.price}</em></span>
									<span class="qg_djs fs_s" data-time="{$vo.end_time|date='Y-m-d H:i:m',###}">
									<if condition="$vo.saled gt 99">
									    <span class="qg_qw fs_s">已抢完</span>
									<else />
										<em class="qg_h">00</em>:<em class="qg_m">00</em>:<em class="qg_s">00</em>
									</if>
									</span>
								</div>
							</a>
						</li>
					</volist>
				</ul>
			</div>
		</div>
		<script type="text/javascript">
			mui.init();
			function countDown(time, day_elem, hour_elem, minute_elem, second_elem) {
				//if(typeof end_time == "string")
				var end_time = new Date(time).getTime(), //月份是实际月份-1
					//current_time = new Date().getTime(),
					sys_second = (end_time - new Date().getTime()) / 1000;
				var timer = setInterval(function() {
					if(sys_second > 0) {
						sys_second -= 1;
						var day = Math.floor((sys_second / 3600) / 24);
						var hour = Math.floor((sys_second / 3600) % 24);
						var minute = Math.floor((sys_second / 60) % 60);
						var second = Math.floor(sys_second % 60);
						day_elem && $(day_elem).text(day); //计算天
						if(day>=1){
							$(hour_elem).text(hour+day*24);
						}else{
							$(hour_elem).text(hour < 10 ? "0" + hour : hour); //计算小时
						}
						$(minute_elem).text(minute < 10 ? "0" + minute : minute); //计算分
						$(second_elem).text(second < 10 ? "0" + second : second); // 计算秒
					} else {
						clearInterval(timer);
					}
				}, 1000);
			}
			$(function(){
      			$(".qg_djs").each(function(){
      				var t1=$(this).attr("data-time");
      				var li_day=$(this).find(".qg_d");
      				var li_hour=$(this).find(".qg_h");
      				var li_mim=$(this).find(".qg_m");
      				var li_s=$(this).find(".qg_s");
      				countDown(t1,null,li_hour,li_mim,li_s);
      			});//遍历页面倒计时，显示倒计时
      			$(".qg_span2").each(function(){
      				var spW=$(this).siblings().find("em").text();
      				$(this).find("em").width(spW);
      			})
			})
		</script>
	</body>

</html>